-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
url: fix performance regression #39778
Conversation
This comment has been minimized.
This comment has been minimized.
@@ -626,7 +626,7 @@ function onParseHashComplete(flags, protocol, username, password, | |||
} | |||
|
|||
function isURLThis(self) { | |||
return self?.[context] !== undefined; | |||
return (self !== undefined && self !== null && self[context] !== undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return (self !== undefined && self !== null && self[context] !== undefined); | |
return self != null && self[context] !== undefined; |
Isn't this faster, or at least equivalent?
or like isURLSearchParams
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fascinating to me, as these two lines of code should generate identical graph representations
PR-URL: #39778 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Landed in f581f6d. |
This (mostly) fixes a performance regression introduced in e1e669b. While this PR does help, it doesn't completely restore performance levels pre- e1e669b but it's fairly close.
Example benchmark results:
/cc @jasnell